<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
      <el-form-item label="用户" prop="username">
        <el-input
          v-model="queryParams.username"
          placeholder="请输入"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select
          v-model="queryParams.status"
          placeholder="用户状态"
          clearable
          size="small"
          style="width: 240px"
        >
          <el-option
            v-for="dict in statusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="推荐码" prop="inviteCode">
        <el-input
          v-model="queryParams.inviteCode"
          placeholder="请输入"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>

    <el-row>
      <el-col>
        <el-table v-loading="loading" :data="roleList">
          <el-table-column label="用户名" prop="username"   v-if="columns[0].visible"/>
          <el-table-column label="用户推荐码" prop="inviteCode"  v-if="columns[1].visible"/>
          <el-table-column label="直推" prop="recommendCount"  v-if="columns[2].visible"/>
          <el-table-column label="团队" prop="teamUserCount"  v-if="columns[3].visible"/>
          <el-table-column label="用户状态" prop="status"  v-if="columns[4].visible">
            <template slot-scope="scope">
              <span v-if="scope.row.status == '1'">
                <el-tooltip class="item" effect="dark" content="停用" placement="top-start">
                  <svg-icon  icon-class="statetingyong" class-name="card-panel-icon" />
                </el-tooltip>
              </span>
              <span v-else-if="scope.row.status == '2'">
                <el-tooltip class="item" effect="dark" content="删除" placement="top-start">
                  <svg-icon  icon-class="stateDelete" class-name="card-panel-icon" />
                </el-tooltip>
              </span>
              <span v-else>
                <el-tooltip class="item" effect="dark" content="正常" placement="top-start">
                  <svg-icon  icon-class="normalState" class-name="card-panel-icon" />
                </el-tooltip>
              </span>
            </template>
          </el-table-column>
          <el-table-column label="是否标记" prop="testFlag"  v-if="columns[5].visible">
            <template slot-scope="scope">
              <span>{{ scope.row.testFlag=='1'?'是':'否' }}</span>
            </template>
            <template slot-scope="scope">
              <span v-if="scope.row.testFlag == '1'">
                <svg-icon  icon-class="gou" class-name="card-panel-icon" />
              </span>
              <span v-else>
                <svg-icon  icon-class="cha" class-name="card-panel-icon" />
              </span>
            </template>
          </el-table-column>
          <el-table-column label="注册时间" align="center" prop="createTime"  v-if="columns[6].visible">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
            width="250">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                @click="handlePassword(scope.row)"
              >修改密码</el-button>
              <el-button
                size="mini"
                type="text"
                @click="handleAsset(scope.row)"
              >资产</el-button>
              <el-button
                size="mini"
                type="text"
                @click="handleUserTeam(scope.row)"
              >团队</el-button>
              <el-button
                size="mini"
                type="text"
                @click="handleUserStatus(scope.row)"
              >锁定/解锁</el-button>
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </el-col>
    </el-row>

    <!-- 修改密码对话框 -->
    <el-dialog :title="titlePassword" :visible.sync="openPassword" width="750px" append-to-body>
      <el-form ref="formPasswordRef" :model="formPassword" label-width="110px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="登录密码" prop="password">
              <el-input v-model="formPassword.password" placeholder="请输入登录密码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="支付密码" prop="payPassword">
              <el-input v-model="formPassword.payPassword" placeholder="请输入支付密码" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm('formPasswordRef')">确 定</el-button>
        <el-button @click="cancel('formPasswordRef')">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 修改用户状态对话框 -->
    <el-dialog :title="titleStatus" :visible.sync="openStatus" width="750px" append-to-body>
      <el-form ref="formStatusRef" :model="formStatus" label-width="110px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="锁定/解锁" prop="status">
              <el-switch
                v-model="formStatus.status"
                active-value="0"
                active-text="解锁"
                inactive-text="锁定"
                inactive-value="1"
              ></el-switch>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm('formStatusRef')">确 定</el-button>
        <el-button @click="cancel('formStatusRef')">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 用户资产信息对话框 -->
    <el-dialog :title="titleAsset" :visible.sync="openAsset" width="750px" append-to-body>

      <el-row class="showPadding15">
        <el-col :span="12">
          <div class="el-form-item el-form-item--medium">
            <label class="el-form-item__label" style="width: 110px;">用户名</label>
            <div class="el-form-item__content" style="margin-left: 110px;">
              <div class="el-input el-input--medium is-disabled">
                {{userBasicInfo.username}}
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="el-form-item el-form-item--medium">
            <label class="el-form-item__label" style="width: 110px;">手机号</label>
            <div class="el-form-item__content" style="margin-left: 110px;">
              <div class="el-input el-input--medium is-disabled">
                {{userBasicInfo.tel}}
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row class="showPadding15">
        <el-col :span="12">
          <div class="el-form-item el-form-item--medium">
            <label class="el-form-item__label" style="width: 110px;">推荐码</label>
            <div class="el-form-item__content" style="margin-left: 110px;">
              <div class="el-input el-input--medium is-disabled">
                {{userBasicInfo.inviteCode}}
              </div>
            </div>
          </div>
        </el-col>
      </el-row>

      <el-tabs v-model="activeAssetTab" type="border-card" @tab-click="handleAssetTab">
        <el-tab-pane label="USDT" name="USDT">
          <asset-info :formAsset="formAsset" />
        </el-tab-pane>
        <el-tab-pane label="BTC" name="BTC">
          <asset-info :formAsset="formAsset" />
        </el-tab-pane>
        <el-tab-pane label="CRU" name="CRU">
          <asset-info :formAsset="formAsset" />
        </el-tab-pane>
        <el-tab-pane label="XCH" name="XCH">
          <asset-info :formAsset="formAsset" />
        </el-tab-pane>
        <el-tab-pane label="BZZ" name="BZZ">
          <asset-info :formAsset="formAsset" />
        </el-tab-pane>
        <el-tab-pane label="PHA" name="PHA">
          <asset-info :formAsset="formAsset" />
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer">
        <el-button @click="openAsset = false">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 用户团队信息对话框 -->
    <el-dialog :title="titleUserTeam" :visible.sync="openUserTeam" width="750px" append-to-body>

      <el-row class="showPadding15">
        <el-col :span="12">
          <div class="el-form-item el-form-item--medium">
            <label class="el-form-item__label" style="width: 150px;">用户名</label>
            <div class="el-form-item__content" style="margin-left: 150px;">
              <div class="el-input el-input--medium is-disabled">
                {{userBasicInfo.username}}
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="el-form-item el-form-item--medium">
            <label class="el-form-item__label" style="width: 150px;">手机号</label>
            <div class="el-form-item__content" style="margin-left: 150px;">
              <div class="el-input el-input--medium is-disabled">
                {{userBasicInfo.tel}}
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row class="showPadding15">
        <el-col :span="12">
          <div class="el-form-item el-form-item--medium">
            <label class="el-form-item__label" style="width: 150px;">推荐码</label>
            <div class="el-form-item__content" style="margin-left: 150px;">
              <div class="el-input el-input--medium is-disabled">
                {{userBasicInfo.inviteCode}}
              </div>
            </div>
          </div>
        </el-col>
      </el-row>

      <el-tabs v-model="activeUserTeamTab" type="border-card" @tab-click="handleUserTeamTab">
        <el-tab-pane label="BTC" name="BTC">
          <btc-user-team :formBtcUserTeam="formBtcUserTeam" @onTell="getUserTeamMessage"/>
        </el-tab-pane>
        <el-tab-pane label="CRU" name="CRU">
          <cru-user-team :formCruUserTeam="formCruUserTeam" @onTell="getUserTeamMessage" />
        </el-tab-pane>
        <el-tab-pane label="XCH" name="XCH">
          <xch-user-team :formXchUserTeam="formXchUserTeam" @onTell="getUserTeamMessage" />
        </el-tab-pane>
        <el-tab-pane label="BZZ" name="BZZ">
          <bzz-user-team :formBzzUserTeam="formBzzUserTeam" @onTell="getUserTeamMessage" />
        </el-tab-pane>
        <el-tab-pane label="PHA" name="PHA">
          <pha-user-team :formPhaUserTeam="formPhaUserTeam" @onTell="getUserTeamMessage" />
        </el-tab-pane>
      </el-tabs>
    </el-dialog>

  </div>
</template>

<script>
import {
  appUserList,
  lockUser,
  unLockUser,
  updateAppUser,
  getAssetDetail,
  getBtcUserTeamDetail,
  getXchUserTeamDetail,
  getCruUserTeamDetail,
  getBzzUserTeamDetail,
  getPhaUserTeamDetail
} from "@/api/biz"
import assetInfo from "./assetInfo";
import btcUserTeam from "./btcUserTeam";
import cruUserTeam from "./cruUserTeam";
import xchUserTeam from "./xchUserTeam";
import phaUserTeam from "./phaUserTeam";
import bzzUserTeam from "./bzzUserTeam";

export default {
  name: "BtcUser",
  components: { assetInfo, btcUserTeam, cruUserTeam, xchUserTeam, bzzUserTeam,  phaUserTeam},
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 角色表格数据
      roleList: [],
      // 日期范围
      dateRange: [],
      // 用户状态数据字典
      statusOptions: [
        {
          dictValue:'0',
          dictLabel:'正常'
        },
        {
          dictValue:'1',
          dictLabel:'停用'
        },
        {
          dictValue:'2',
          dictLabel:'删除'
        }
      ],
      // 用户等级数据字典
      levelOptions:[
        {
          dictValue:0,
          dictLabel:'V0'
        },
        {
          dictValue:1,
          dictLabel:'V1'
        },
        {
          dictValue:2,
          dictLabel:'V2'
        },
        {
          dictValue:3,
          dictLabel:'V3'
        },
        {
          dictValue:4,
          dictLabel:'V4'
        },
        {
          dictValue:5,
          dictLabel:'V5'
        }
      ],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        username: undefined,
        status: undefined,
        inviteCode: undefined
      },
      // 列信息
      columns: [
        { key: 0, label: `用户名`, visible: true },
        { key: 1, label: `用户推荐码`, visible: true },
        { key: 2, label: `直推`, visible: true },
        { key: 3, label: `团队`, visible: true },
        { key: 4, label: `用户状态`, visible: true },
        { key: 5, label: `是否标记`, visible: true },
        { key: 6, label: `注册时间`, visible: true }
      ],

      activeAssetTab: 'USDT',
      activeUserTeamTab:'BTC',


      openPassword: false,    //修改密码操作
      titlePassword:'',
      formPassword: {
        id: '',
        password:'',    //登录密码
        payPassword:''    //支付密码
      },

      openStatus: false,    //修改用户状态操作
      titleStatus:'',
      formStatus: {
        id: '',
        status:''    //登录密码
      },

      openAsset: false,    //用户资产信息列表
      titleAsset:'',
      userBasicInfo: {
        username:'',    //用户名
        tel:'',      //手机号
        inviteCode:'' ,  //推荐码
      },
      formAsset: {
        id: '',
        balance:'',
        depositAmount:'',
        withdrawAmount:'',
        freezeAmount:''
      },

      openUserTeam: false,
      titleUserTeam:'',
      formBtcUserTeam: {    //btc团队信息
        id:'',
        currency:'',

        recommendInvestCount:'',
        teamInvestUserCount:'',
        teamInvestAmount:'',
        investFlag:'',
        investAmount:'',
        level:'',
        fixLevelFlag:'',
        power:'',
        teamPowerFlag:''
      },
      formCruUserTeam: {    //cru团队信息
        id:'',
        currency:'',

        recommendInvestCount:'',
        teamInvestUserCount:'',
        teamInvestAmount:'',
        investFlag:'',
        investAmount:'',
        level:'',
        fixLevelFlag:'',
        power:'',
        buyPower:'',
        packagePower:'',
        teamPower:'',
        bigDistrictPower:'',
        totalTinyDistrictPower:''
      },
      formXchUserTeam: {     //xch团队信息
        id:'',
        currency:'',
        recommendInvestCount:'',
        teamInvestUserCount:'',
        teamInvestAmount:'',
        investFlag:'',
        investAmount:'',
        level:'',
        fixLevelFlag:'',
        power:'',
        buyPower:'',
        packagePower:'',
        teamPower:'',
        bigDistrictPower:'',
        totalTinyDistrictPower:''
      },
      formBzzUserTeam: {  //bzz团队信息
        id:'',
        currency:'',
        recommendInvestCount:'',
        teamInvestUserCount:'',
        teamInvestAmount:'',
        investFlag:'',
        investAmount:'',
        level:'',
        fixLevelFlag:'',
        power:'',
        buyPower:'',
        packagePower:'',
        teamPower:'',
        bigDistrictPower:'',
        totalTinyDistrictPower:''
      },
      formPhaUserTeam: {  //pha团队信息
        id:'',
        currency:'',
        recommendInvestCount:'',
        teamInvestUserCount:'',
        teamInvestAmount:'',
        investFlag:'',
        investAmount:'',
        level:'',
        fixLevelFlag:'',
        power:'',
        buyPower:'',
        packagePower:'',
        teamPower:'',
        bigDistrictPower:'',
        totalTinyDistrictPower:''
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getUserTeamMessage(message){
      if (message.code == '200'){
        this.openUserTeam = false;
        this.getList();
      }
    },
    // 状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    // 等级字典翻译
    levelFormat(row, column) {
      return this.selectDictLabel(this.levelOptions, row.level);
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      appUserList(this.addDateRange(this.queryParams, this.dateRange)).then(
        response => {
          this.roleList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    // 取消按钮
    cancel(form) {
      this.reset(form);
    },
    // 表单重置
    reset(form) {
      if (form == 'formPasswordRef'){
        this.openPassword = false;
        this.formPassword = {
          id: '',
          password:'',    //登录密码
          payPassword:''    //支付密码
        }
      }else if (form == 'formStatusRef'){
        this.openStatus = false;
        this.formStatus = {
          id: '',
          status:''    //登录密码
        }
      }else if (form == 'formUserTeamRef'){
        this.openUserTeam = false;
      }

      this.resetForm(form);
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 修改按钮操作 */
    /** 修改密码*/
    handlePassword(row){
      this.reset('formPasswordRef');
      this.formPassword.id = row.id;
      this.openPassword = true;
      this.titlePassword = "修改密码";
    },
    /** 修改用户状态*/
    handleUserStatus(row){
      this.reset('formStatusRef');
      this.formStatus.id = row.id;
      this.formStatus.status = row.status;
      this.openStatus = true;
      this.titleStatus = "修改用户状态";
    },
    /** 用户资产查询*/
    handleAssetTab(tab, event){
      this.getAssetDetailFn(this.formAsset.id, tab.name)
    },
    getAssetDetailFn(id, currency){
      this.formAsset.balance = 0
      this.formAsset.depositAmount = 0
      this.formAsset.freezeAmount = 0
      this.formAsset.withdrawAmount = 0
      getAssetDetail(id, currency).then(res => {
        if (res.data!=null ){
          this.formAsset.balance = res.data.balance;
          this.formAsset.depositAmount = res.data.depositAmount;
          this.formAsset.freezeAmount = res.data.freezeAmount;
          this.formAsset.withdrawAmount = res.data.withdrawAmount
        }
      });
    },
    handleAsset(row){
      this.formAsset.id = row.id;
      this.userBasicInfo.username = row.username;
      this.userBasicInfo.tel = row.tel;
      this.userBasicInfo.inviteCode = row.inviteCode;
      this.openAsset = true;
      this.activeAssetTab = 'USDT';
      this.titleAsset = "查看用户资产";
      this.getAssetDetailFn(this.formAsset.id, 'USDT')
    },
    /** 设置用户团队相关信息*/
    handleUserTeamTab(tab, event){
      if (tab.name == 'BTC'){
        this.getBtcUserTeamDetailFn(this.formBtcUserTeam.id, tab.name)
      }else if(tab.name == 'CRU'){
        this.getCruUserTeamDetailFn(this.formCruUserTeam.id, tab.name)
      }else if(tab.name == 'XCH'){
        this.getXchUserTeamDetailFn(this.formXchUserTeam.id, tab.name)
      }else if(tab.name == 'BZZ'){
        this.getBzzUserTeamDetailFn(this.formBzzUserTeam.id, tab.name)
      }else {
        this.getPhaUserTeamDetailFn(this.formPhaUserTeam.id, tab.name)
      }
    },
    handleUserTeam(row){
      this.userBasicInfo.username = row.username;
      this.userBasicInfo.tel = row.tel;
      this.userBasicInfo.inviteCode = row.inviteCode;

      this.formBtcUserTeam.id = row.id;
      this.formBtcUserTeam.currency = 'BTC';
      // this.formBtcUserTeam.username = row.username;
      // this.formBtcUserTeam.tel = row.tel;
      // this.formBtcUserTeam.inviteCode = row.inviteCode;

      this.formCruUserTeam.id = row.id;
      this.formCruUserTeam.currency = 'CRU';

      this.formXchUserTeam.id = row.id;
      this.formXchUserTeam.currency = 'XCH';

      this.formBzzUserTeam.id = row.id;
      this.formBzzUserTeam.currency = 'BZZ';

      this.formPhaUserTeam.id = row.id;
      this.formPhaUserTeam.currency = 'PHA';

      this.openUserTeam = true;
      this.activeUserTeamTab = 'BTC';
      this.titleUserTeam = "修改团队信息";
      this.getBtcUserTeamDetailFn(this.formBtcUserTeam.id);
    },
    getBtcUserTeamDetailFn(userId){
      getBtcUserTeamDetail(userId).then(res => {
        this.formBtcUserTeam.investAmount = res.data.investAmount;
        this.formBtcUserTeam.investFlag = res.data.investFlag;
        this.formBtcUserTeam.level = res.data.level;
        this.formBtcUserTeam.fixLevelFlag = res.data.fixLevelFlag;
        this.formBtcUserTeam.power = res.data.power;
        this.formBtcUserTeam.recommendInvestCount = res.data.recommendInvestCount;
        this.formBtcUserTeam.teamInvestAmount = res.data.teamInvestAmount;
        this.formBtcUserTeam.teamInvestUserCount = res.data.teamInvestUserCount;
        this.formBtcUserTeam.teamPowerFlag = res.data.teamPowerFlag;
      });
    },
    getCruUserTeamDetailFn(userId){
      getCruUserTeamDetail(userId).then(res => {
        this.formCruUserTeam.investAmount = res.data.investAmount;
        this.formCruUserTeam.investFlag = res.data.investFlag;
        this.formCruUserTeam.level = res.data.level;
        this.formCruUserTeam.fixLevelFlag = res.data.fixLevelFlag;
        this.formCruUserTeam.power = res.data.power;
        this.formCruUserTeam.recommendInvestCount = res.data.recommendInvestCount;
        this.formCruUserTeam.teamInvestAmount = res.data.teamInvestAmount;
        this.formCruUserTeam.teamInvestUserCount = res.data.teamInvestUserCount;
        this.formCruUserTeam.buyPower = res.data.buyPower;
        this.formCruUserTeam.packagePower = res.data.packagePower;
        this.formCruUserTeam.teamPower = res.data.teamPower;
        this.formCruUserTeam.bigDistrictPower = res.data.bigDistrictPower;
        this.formCruUserTeam.totalTinyDistrictPower = res.data.totalTinyDistrictPower;
      });
    },
    getXchUserTeamDetailFn(userId){
      getXchUserTeamDetail(userId).then(res => {
        this.formXchUserTeam.investAmount = res.data.investAmount;
        this.formXchUserTeam.investFlag = res.data.investFlag;
        this.formXchUserTeam.level = res.data.level;
        this.formXchUserTeam.fixLevelFlag = res.data.fixLevelFlag;
        this.formXchUserTeam.power = res.data.power;
        this.formXchUserTeam.recommendInvestCount = res.data.recommendInvestCount;
        this.formXchUserTeam.teamInvestAmount = res.data.teamInvestAmount;
        this.formXchUserTeam.teamInvestUserCount = res.data.teamInvestUserCount;
        this.formXchUserTeam.buyPower = res.data.buyPower;
        this.formXchUserTeam.packagePower = res.data.packagePower;
        this.formXchUserTeam.teamPower = res.data.teamPower;
        this.formXchUserTeam.bigDistrictPower = res.data.bigDistrictPower;
        this.formXchUserTeam.totalTinyDistrictPower = res.data.totalTinyDistrictPower;
      });
    },
    getBzzUserTeamDetailFn(userId){
      getBzzUserTeamDetail(userId).then(res => {
        this.formBzzUserTeam.investAmount = res.data.investAmount;
        this.formBzzUserTeam.investFlag = res.data.investFlag;
        this.formBzzUserTeam.level = res.data.level;
        this.formBzzUserTeam.fixLevelFlag = res.data.fixLevelFlag;
        this.formBzzUserTeam.power = res.data.power;
        this.formBzzUserTeam.recommendInvestCount = res.data.recommendInvestCount;
        this.formBzzUserTeam.teamInvestAmount = res.data.teamInvestAmount;
        this.formBzzUserTeam.teamInvestUserCount = res.data.teamInvestUserCount;
        this.formBzzUserTeam.buyPower = res.data.buyPower;
        this.formBzzUserTeam.packagePower = res.data.packagePower;
        this.formBzzUserTeam.teamPower = res.data.teamPower;
        this.formBzzUserTeam.bigDistrictPower = res.data.bigDistrictPower;
        this.formBzzUserTeam.totalTinyDistrictPower = res.data.totalTinyDistrictPower;
      });
    },
    getPhaUserTeamDetailFn(userId){
      getPhaUserTeamDetail(userId).then(res => {
        this.formPhaUserTeam.investAmount = res.data.investAmount;
        this.formPhaUserTeam.investFlag = res.data.investFlag;
        this.formPhaUserTeam.level = res.data.level;
        this.formPhaUserTeam.fixLevelFlag = res.data.fixLevelFlag;
        this.formPhaUserTeam.power = res.data.power;
        this.formPhaUserTeam.recommendInvestCount = res.data.recommendInvestCount;
        this.formPhaUserTeam.teamInvestAmount = res.data.teamInvestAmount;
        this.formPhaUserTeam.teamInvestUserCount = res.data.teamInvestUserCount;
        this.formPhaUserTeam.buyPower = res.data.buyPower;
        this.formPhaUserTeam.packagePower = res.data.packagePower;
        this.formPhaUserTeam.teamPower = res.data.teamPower;
        this.formPhaUserTeam.bigDistrictPower = res.data.bigDistrictPower;
        this.formPhaUserTeam.totalTinyDistrictPower = res.data.totalTinyDistrictPower;
      });
    },
    /** 提交按钮 */
    submitForm(form){
      this.$refs[form].validate(valid => {
        if (valid) {
          //修改密码
          if (form == 'formPasswordRef'){
            updateAppUser(this.formPassword).then(response => {
              this.msgSuccess("修改成功");
              this.openPassword = false;
              this.getList();
            });
            return;
          }
          //修改用户状态
          if (form == 'formStatusRef'){
            if (this.formStatus.status == 1){
              lockUser(this.formStatus.id).then(response => {
                this.msgSuccess("锁住成功");
                this.openStatus = false;
                this.getList();
              });
            }else {
              unLockUser(this.formStatus.id).then(response => {
                this.msgSuccess("解锁成功");
                this.openStatus = false;
                this.getList();
              });
            }
            return;
          }
        }
      });
    }
  }
};
</script>
<style lang="scss">
.showPadding15{
  padding: 0 15px;
}
.showDisabledClas {
  .el-input.is-disabled .el-input__inner,  .el-textarea.is-disabled .el-textarea__inner{
    color: #606266;
  }
}
</style>
